export default {
    powerCounter(state){
        return state.counter*state.counter
    },
    more20Stu(state){
        return state.students.filter(s=>s.age>20)
    },
    // 第二个参数是getters
    more20StuLen(state,getters){
        return getters.more20Stu.length
    },
    // 添加自定义参数
    moreAgeStu(state){
        // 写法1:
        // return function(age){
        //     return state.students.filter(s=>s.age>age)
        // }

        //写法2:箭头函数
        return age=>{
            return state.students.filter(s=>s.age>age)
        }
    }
}